package com.ruoyi.activiti.mapper;

import com.ruoyi.activiti.condition.TodoCondition;
import com.ruoyi.activiti.domain.IHistoricTaskInstance;
import com.ruoyi.activiti.domain.IProcessInstance;
import com.ruoyi.activiti.domain.ITask;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author danghf
 * @version 1.0
 * @date 2024/05/07 10:15
 * activitiMapper 自己写sql
 */
@Mapper
public interface ActivitiMapper {
    /**
     * 我的待办任务
     * @param userId userId
     */
    List<ITask> getMeToDone(@Param("userId")Long userId, @Param("roles")List<Long> roles,
                            @Param("condition")TodoCondition condition);

    /**
     * 全部待办
     */
    List<ITask> getAllToDone(TodoCondition condition);

    /**
     * 我的已办任务
     * @param userId userId
     */
    List<IHistoricTaskInstance> getCompletedTaskWithMe(@Param("userId")Long userId, @Param("condition")TodoCondition condition);

    /**
     * 获取全部流程，包含结束与未结束的流程
     */
    List<IProcessInstance> getProcessInstances(TodoCondition condition);

    /**
     * 获取流程实例
     */
    List<IProcessInstance> getProcessInstanceByUserId(@Param("userId")Long userId, @Param("condition")TodoCondition condition);

    /**
     * 判断用户是否有执行权限
     * @param userId userId
     * @param roles roles
     * @param taskId taskId
     */
    int hasExecutionAuthority(@Param("userId")Long userId,@Param("roles") List<Long> roles,@Param("taskId") String taskId);
}
